<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>树洞交友 - 发现身边的故事</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f9fafb;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 10px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 65px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--primary);
        }
        
        .nav-actions {
            display: flex;
            gap: 18px;
            font-size: 1.25rem;
            color: var(--text-secondary);
        }
        
        /* 搜索和筛选区 */
        .search-filter-container {
            background-color: var(--bg-white);
            padding: 12px 15px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-input-group {
            position: relative;
            margin-bottom: 12px;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 15px 10px 40px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 筛选工具栏 */
        .filter-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .filter-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 0.9rem;
            padding: 5px 10px;
            border-radius: 6px;
        }
        
        .filter-btn.active {
            background-color: var(--primary-light);
            color: white;
        }
        
        /* 筛选面板 */
        .filter-panel {
            position: fixed;
            top: 55px;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--bg-white);
            z-index: 900;
            transform: translateY(100%);
            transition: transform 0.3s ease;
            overflow-y: auto;
        }
        
        .filter-panel.show {
            transform: translateY(0);
        }
        
        .panel-header {
            padding: 15px;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .panel-title {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .panel-close {
            background: none;
            border: none;
            font-size: 1.2rem;
            color: var(--text-secondary);
        }
        
        .filter-section {
            padding: 15px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .section-title {
            font-size: 0.95rem;
            font-weight: 600;
            margin-bottom: 12px;
            color: var(--text-primary);
        }
        
        /* 分类筛选 */
        .category-filter {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .category-chip {
            padding: 6px 12px;
            background-color: var(--bg-light);
            border-radius: 15px;
            font-size: 0.85rem;
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
        }
        
        .category-chip.selected {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 时间筛选 */
        .time-filter {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .time-option {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
        }
        
        .time-option input {
            width: 18px;
            height: 18px;
            accent-color: var(--primary);
        }
        
        /* 距离筛选 */
        .distance-slider {
            width: 100%;
            margin: 15px 0;
        }
        
        .distance-value {
            text-align: center;
            color: var(--primary);
            font-weight: 600;
        }
        
        /* 内容类型筛选 */
        .content-type-options {
            display: flex;
            gap: 15px;
        }
        
        .content-type-option {
            flex: 1;
            text-align: center;
            padding: 10px 0;
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
        }
        
        .content-type-option.selected {
            border-color: var(--primary);
            background-color: rgba(79, 70, 229, 0.1);
        }
        
        .content-type-option i {
            font-size: 1.2rem;
            margin-bottom: 5px;
            color: var(--primary);
        }
        
        .content-type-option span {
            font-size: 0.85rem;
        }
        
        /* 筛选按钮组 */
        .filter-actions {
            display: flex;
            padding: 15px;
            gap: 10px;
        }
        
        .reset-filters {
            flex: 1;
            padding: 10px;
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            background-color: white;
            color: var(--text-secondary);
            font-size: 0.95rem;
        }
        
        .apply-filters {
            flex: 1;
            padding: 10px;
            border: none;
            border-radius: var(--radius);
            background-color: var(--primary);
            color: white;
            font-size: 0.95rem;
        }
        
        /* 分类标签 */
        .category-tabs {
            display: flex;
            padding: 8px 15px;
            background-color: var(--bg-white);
            overflow-x: auto;
            scrollbar-width: none;
            border-bottom: 1px solid var(--border-light);
        }
        
        .category-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .category-tab {
            padding: 6px 15px;
            border-radius: 15px;
            font-size: 0.9rem;
            white-space: nowrap;
            margin-right: 8px;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
        }
        
        .category-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 筛选结果标签 */
        .filter-tags {
            padding: 8px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .filter-tag {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            border-radius: 12px;
            font-size: 0.8rem;
        }
        
        .remove-tag {
            background: none;
            border: none;
            color: var(--primary);
            font-size: 0.9rem;
            cursor: pointer;
        }
        
        /* 树洞列表 */
        .treehole-list {
            padding: 0 15px;
        }
        
        .treehole-item {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 15px;
            margin-top: 12px;
            box-shadow: var(--shadow);
        }
        
        .treehole-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .user-name {
            font-weight: 500;
            font-size: 0.95rem;
        }
        
        .post-meta {
            font-size: 0.8rem;
            color: var(--text-light);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .distance-badge {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            font-size: 0.75rem;
            color: var(--primary);
        }
        
        .more-options {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1rem;
        }
        
        .treehole-content {
            margin-bottom: 12px;
            line-height: 1.5;
            font-size: 0.95rem;
        }
        
        /* 图片容器 */
        .images-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
            margin-bottom: 12px;
            border-radius: 6px;
            overflow: hidden;
        }
        
        .images-container.single {
            grid-template-columns: 1fr;
            max-height: 300px;
        }
        
        .images-container.double {
            grid-template-columns: repeat(2, 1fr);
        }
        
        .treehole-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            aspect-ratio: 1/1;
        }
        
        .images-container.single .treehole-image {
            aspect-ratio: 4/3;
        }
        
        /* 互动区域 */
        .treehole-actions {
            display: flex;
            justify-content: space-between;
            padding-top: 8px;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 0.85rem;
            padding: 5px 0;
        }
        
        .action-btn.liked {
            color: var(--danger);
        }
        
        .action-btn i {
            font-size: 1rem;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .add-post-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            margin-top: -25px;
            box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
        }
        
        /* 加载提示 */
        .loading-indicator {
            text-align: center;
            padding: 20px;
            color: var(--text-secondary);
        }
        
        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 40px 20px;
            color: var(--text-secondary);
        }
        
        .empty-state i {
            font-size: 3rem;
            margin-bottom: 15px;
            color: var(--text-light);
        }
        
        .empty-state p {
            margin-bottom: 20px;
        }
        
        .empty-state button {
            padding: 8px 20px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 20px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <div class="nav-logo">
            <i class="fas fa-tree"></i>
        </div>
        <div class="nav-title">树洞交友</div>
        <div class="nav-actions">
            <i class="far fa-bell"></i>
            <i class="far fa-envelope"></i>
        </div>
    </div>
    
    <!-- 搜索和筛选区 -->
    <div class="search-filter-container">
        <div class="search-input-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索树洞、话题或用户...">
        </div>
        
        <div class="filter-toolbar">
            <button class="filter-btn" id="categoryFilterBtn">
                <i class="fas fa-th-large"></i>
                <span>分类</span>
            </button>
            <button class="filter-btn" id="timeFilterBtn">
                <i class="far fa-clock"></i>
                <span>时间</span>
            </button>
            <button class="filter-btn" id="distanceFilterBtn">
                <i class="fas fa-map-marker-alt"></i>
                <span>距离</span>
            </button>
            <button class="filter-btn" id="contentFilterBtn">
                <i class="fas fa-image"></i>
                <span>内容</span>
            </button>
            <button class="filter-btn" id="advancedFilterBtn">
                <i class="fas fa-sliders-h"></i>
                <span>更多</span>
            </button>
        </div>
    </div>
    
    <!-- 筛选结果标签 -->
    <div class="filter-tags" id="filterTags">
        <!-- 筛选标签会动态添加到这里 -->
    </div>
    
    <!-- 分类快速标签 -->
    <div class="category-tabs">
        <button class="category-tab active">推荐</button>
        <button class="category-tab">附近</button>
        <button class="category-tab">情感</button>
        <button class="category-tab">兴趣</button>
        <button class="category-tab">校园</button>
        <button class="category-tab">职场</button>
    </div>
    
    <!-- 树洞列表 -->
    <div class="treehole-list" id="treeholeList">
        <!-- 无图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">星辰大海</div>
                        <div class="post-meta">
                            <span>2小时前 · 情感</span>
                            <span class="distance-badge"><i class="fas fa-map-marker-alt"></i> 0.8km</span>
                        </div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                最近感觉很迷茫，不知道自己真正想要的是什么。工作稳定但没有激情，想辞职又怕找不到更好的。有没有人有过类似的经历，能给点建议吗？
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>32</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>56</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 单图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">咖啡不加糖</div>
                        <div class="post-meta">
                            <span>昨天 19:45 · 爱好</span>
                            <span class="distance-badge"><i class="fas fa-map-marker-alt"></i> 1.2km</span>
                        </div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                周末发现的一家小众咖啡馆，环境特别好，咖啡也很正宗。有没有喜欢探店的朋友，下次可以一起啊~
            </div>
            <div class="images-container single">
                <img src="https://picsum.photos/id/431/800/600" alt="咖啡馆照片" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>18</span>
                </button>
                <button class="action-btn liked">
                    <i class="fas fa-heart"></i>
                    <span>94</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 三图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/67/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">美食探险家</div>
                        <div class="post-meta">
                            <span>4天前 · 爱好</span>
                            <span class="distance-badge"><i class="fas fa-map-marker-alt"></i> 3.5km</span>
                        </div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                周末在家尝试做了三道新菜，味道居然还不错！有没有喜欢烹饪的朋友，交流一下经验呀~
            </div>
            <div class="images-container">
                <img src="https://picsum.photos/id/292/400/400" alt="美食照片1" class="treehole-image">
                <img src="https://picsum.photos/id/431/400/400" alt="美食照片2" class="treehole-image">
                <img src="https://picsum.photos/id/488/400/400" alt="美食照片3" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>67</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>215</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <div class="nav-item active">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </div>
        <div class="add-post-btn">
            <i class="fas fa-plus"></i>
        </div>
        <div class="nav-item">
            <i class="far fa-bell"></i>
            <span>通知</span>
        </div>
        <div class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </div>
    </div>
    
    <!-- 筛选面板 -->
    <div class="filter-panel" id="filterPanel">
        <div class="panel-header">
            <div class="panel-title" id="panelTitle">分类筛选</div>
            <button class="panel-close" id="panelClose">
                <i class="fas fa-times"></i>
            </button>
        </div>
        
        <!-- 分类筛选内容 -->
        <div class="filter-content" id="categoryFilterContent">
            <div class="filter-section">
                <div class="section-title">选择分类</div>
                <div class="category-filter">
                    <div class="category-chip selected">推荐</div>
                    <div class="category-chip">附近</div>
                    <div class="category-chip">情感</div>
                    <div class="category-chip">兴趣</div>
                    <div class="category-chip">校园</div>
                    <div class="category-chip">职场</div>
                    <div class="category-chip">爱好</div>
                    <div class="category-chip">匿名</div>
                    <div class="category-chip">音乐</div>
                    <div class="category-chip">电影</div>
                    <div class="category-chip">读书</div>
                    <div class="category-chip">运动</div>
                </div>
            </div>
        </div>
        
        <!-- 时间筛选内容 (默认隐藏) -->
        <div class="filter-content" id="timeFilterContent" style="display: none;">
            <div class="filter-section">
                <div class="section-title">选择时间范围</div>
                <div class="time-filter">
                    <div class="time-option">
                        <input type="radio" name="time" id="timeAll" checked>
                        <label for="timeAll">全部时间</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="time" id="timeToday">
                        <label for="timeToday">今天</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="time" id="timeWeek">
                        <label for="timeWeek">近7天</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="time" id="timeMonth">
                        <label for="timeMonth">近30天</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="time" id="timeCustom">
                        <label for="timeCustom">自定义范围</label>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 距离筛选内容 (默认隐藏) -->
        <div class="filter-content" id="distanceFilterContent" style="display: none;">
            <div class="filter-section">
                <div class="section-title">选择距离范围</div>
                <input type="range" min="1" max="20" value="5" class="distance-slider" id="distanceSlider">
                <div class="distance-value" id="distanceValue">5公里以内</div>
                <div class="time-filter">
                    <div class="time-option">
                        <input type="radio" name="distance" id="distance1" checked>
                        <label for="distance1">5公里以内</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="distance" id="distance2">
                        <label for="distance2">10公里以内</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="distance" id="distance3">
                        <label for="distance3">20公里以内</label>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 内容类型筛选 (默认隐藏) -->
        <div class="filter-content" id="contentFilterContent" style="display: none;">
            <div class="filter-section">
                <div class="section-title">内容类型</div>
                <div class="content-type-options">
                    <div class="content-type-option selected">
                        <i class="fas fa-th"></i>
                        <span>全部</span>
                    </div>
                    <div class="content-type-option">
                        <i class="fas fa-image"></i>
                        <span>有图</span>
                    </div>
                    <div class="content-type-option">
                        <i class="fas fa-file-alt"></i>
                        <span>无图</span>
                    </div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">热门程度</div>
                <div class="time-filter">
                    <div class="time-option">
                        <input type="radio" name="popularity" id="popularityAll" checked>
                        <label for="popularityAll">不限制</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="popularity" id="popularityHigh">
                        <label for="popularityHigh">高点赞</label>
                    </div>
                    <div class="time-option">
                        <input type="radio" name="popularity" id="popularityComment">
                        <label for="popularityComment">高评论</label>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 筛选按钮组 -->
        <div class="filter-actions">
            <button class="reset-filters" id="resetFilters">重置</button>
            <button class="apply-filters" id="applyFilters">应用筛选</button>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 筛选面板控制
        const filterPanel = document.getElementById('filterPanel');
        const panelTitle = document.getElementById('panelTitle');
        const panelClose = document.getElementById('panelClose');
        const filterContents = document.querySelectorAll('.filter-content');
        
        // 筛选按钮
        const categoryFilterBtn = document.getElementById('categoryFilterBtn');
        const timeFilterBtn = document.getElementById('timeFilterBtn');
        const distanceFilterBtn = document.getElementById('distanceFilterBtn');
        const contentFilterBtn = document.getElementById('contentFilterBtn');
        const advancedFilterBtn = document.getElementById('advancedFilterBtn');
        
        // 筛选内容区域
        const categoryFilterContent = document.getElementById('categoryFilterContent');
        const timeFilterContent = document.getElementById('timeFilterContent');
        const distanceFilterContent = document.getElementById('distanceFilterContent');
        const contentFilterContent = document.getElementById('contentFilterContent');
        
        // 显示特定筛选面板
        function showFilterPanel(title, contentElement) {
            panelTitle.textContent = title;
            
            // 隐藏所有筛选内容
            filterContents.forEach(content => {
                content.style.display = 'none';
            });
            
            // 显示选中的筛选内容
            contentElement.style.display = 'block';
            
            // 显示筛选面板
            filterPanel.classList.add('show');
            document.body.style.overflow = 'hidden';
        }
        
        // 绑定筛选按钮事件
        categoryFilterBtn.addEventListener('click', () => {
            showFilterPanel('分类筛选', categoryFilterContent);
        });
        
        timeFilterBtn.addEventListener('click', () => {
            showFilterPanel('时间筛选', timeFilterContent);
        });
        
        distanceFilterBtn.addEventListener('click', () => {
            showFilterPanel('距离筛选', distanceFilterContent);
        });
        
        contentFilterBtn.addEventListener('click', () => {
            showFilterPanel('内容筛选', contentFilterContent);
        });
        
        advancedFilterBtn.addEventListener('click', () => {
            showFilterPanel('高级筛选', contentFilterContent);
        });
        
        // 关闭筛选面板
        panelClose.addEventListener('click', () => {
            filterPanel.classList.remove('show');
            document.body.style.overflow = '';
        });
        
        // 分类筛选芯片选择
        const categoryChips = document.querySelectorAll('.category-chip');
        categoryChips.forEach(chip => {
            chip.addEventListener('click', () => {
                // 对于"推荐"选项，取消其他选中状态
                if (chip.textContent === '推荐') {
                    categoryChips.forEach(c => c.classList.remove('selected'));
                    chip.classList.add('selected');
                } else {
                    // 取消"推荐"的选中状态
                    categoryChips.forEach(c => {
                        if (c.textContent === '推荐') {
                            c.classList.remove('selected');
                        }
                    });
                    // 切换当前芯片状态
                    chip.classList.toggle('selected');
                }
            });
        });
        
        // 距离滑块
        const distanceSlider = document.getElementById('distanceSlider');
        const distanceValue = document.getElementById('distanceValue');
        
        distanceSlider.addEventListener('input', () => {
            const value = distanceSlider.value;
            distanceValue.textContent = `${value}公里以内`;
            
            // 更新单选按钮状态
            if (value <= 5) {
                document.getElementById('distance1').checked = true;
            } else if (value <= 10) {
                document.getElementById('distance2').checked = true;
            } else {
                document.getElementById('distance3').checked = true;
            }
        });
        
        // 距离单选按钮
        document.getElementById('distance1').addEventListener('change', () => {
            if (document.getElementById('distance1').checked) {
                distanceSlider.value = 5;
                distanceValue.textContent = '5公里以内';
            }
        });
        
        document.getElementById('distance2').addEventListener('change', () => {
            if (document.getElementById('distance2').checked) {
                distanceSlider.value = 10;
                distanceValue.textContent = '10公里以内';
            }
        });
        
        document.getElementById('distance3').addEventListener('change', () => {
            if (document.getElementById('distance3').checked) {
                distanceSlider.value = 20;
                distanceValue.textContent = '20公里以内';
            }
        });
        
        // 内容类型选择
        const contentTypeOptions = document.querySelectorAll('.content-type-option');
        contentTypeOptions.forEach(option => {
            option.addEventListener('click', () => {
                contentTypeOptions.forEach(opt => opt.classList.remove('selected'));
                option.classList.add('selected');
            });
        });
        
        // 筛选标签管理
        const filterTags = document.getElementById('filterTags');
        const appliedFilters = new Set();
        
        // 添加筛选标签
        function addFilterTag(text, type) {
            // 检查是否已存在
            if (appliedFilters.has(text)) return;
            
            appliedFilters.add(text);
            
            const tag = document.createElement('div');
            tag.className = 'filter-tag';
            tag.dataset.type = type;
            tag.innerHTML = `
                <span>${text}</span>
                <button class="remove-tag">
                    <i class="fas fa-times"></i>
                </button>
            `;
            
            // 移除标签事件
            tag.querySelector('.remove-tag').addEventListener('click', (e) => {
                e.stopPropagation();
                tag.remove();
                appliedFilters.delete(text);
                updateFilterButtons();
                applyFilters(); // 重新应用筛选
            });
            
            filterTags.appendChild(tag);
        }
        
        // 清除所有筛选标签
        function clearAllFilterTags() {
            filterTags.innerHTML = '';
            appliedFilters.clear();
        }
        
        // 更新筛选按钮状态
        function updateFilterButtons() {
            // 根据当前筛选状态更新按钮样式
            const hasFilters = appliedFilters.size > 0;
            
            // 简单示例：如果有筛选条件，高亮"更多"按钮
            if (hasFilters) {
                advancedFilterBtn.classList.add('active');
            } else {
                advancedFilterBtn.classList.remove('active');
            }
        }
        
        // 应用筛选
        document.getElementById('applyFilters').addEventListener('click', () => {
            clearAllFilterTags();
            
            // 获取分类筛选
            const selectedCategories = [];
            categoryChips.forEach(chip => {
                if (chip.classList.contains('selected')) {
                    selectedCategories.push(chip.textContent);
                }
            });
            
            // 添加分类标签
            selectedCategories.forEach(cat => {
                if (cat !== '推荐' || selectedCategories.length === 1) {
                    addFilterTag(cat, 'category');
                }
            });
            
            // 获取时间筛选
            const selectedTime = document.querySelector('input[name="time"]:checked + label').textContent;
            if (selectedTime !== '全部时间') {
                addFilterTag(selectedTime, 'time');
            }
            
            // 获取距离筛选
            const selectedDistance = document.querySelector('input[name="distance"]:checked + label').textContent;
            if (selectedDistance !== '5公里以内') { // 默认值
                addFilterTag(selectedDistance, 'distance');
            }
            
            // 获取内容类型筛选
            let contentType = '全部';
            contentTypeOptions.forEach(option => {
                if (option.classList.contains('selected')) {
                    contentType = option.querySelector('span').textContent;
                }
            });
            
            if (contentType !== '全部') {
                addFilterTag(contentType, 'content');
            }
            
            // 获取热门程度筛选
            const selectedPopularity = document.querySelector('input[name="popularity"]:checked + label').textContent;
            if (selectedPopularity !== '不限制') {
                addFilterTag(selectedPopularity, 'popularity');
            }
            
            // 关闭筛选面板
            filterPanel.classList.remove('show');
            document.body.style.overflow = '';
            
            // 更新筛选按钮状态
            updateFilterButtons();
            
            // 应用筛选并刷新列表
            applyFilters();
        });
        
        // 重置筛选
        document.getElementById('resetFilters').addEventListener('click', () => {
            // 重置分类筛选
            categoryChips.forEach((chip, index) => {
                chip.classList.toggle('selected', index === 0); // 选中第一个"推荐"
            });
            
            // 重置时间筛选
            document.getElementById('timeAll').checked = true;
            
            // 重置距离筛选
            document.getElementById('distance1').checked = true;
            distanceSlider.value = 5;
            distanceValue.textContent = '5公里以内';
            
            // 重置内容类型筛选
            contentTypeOptions.forEach((option, index) => {
                option.classList.toggle('selected', index === 0); // 选中第一个"全部"
            });
            
            // 重置热门程度筛选
            document.getElementById('popularityAll').checked = true;
        });
        
        // 应用筛选并刷新列表
        function applyFilters() {
            const treeholeList = document.getElementById('treeholeList');
            
            // 显示加载状态
            treeholeList.innerHTML = `
                <div class="loading-indicator">
                    <i class="fas fa-spinner fa-spin"></i> 正在加载内容...
                </div>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                // 这里根据实际筛选条件加载不同内容
                // 简单起见，我们只是重新显示原始内容
                treeholeList.innerHTML = `
                    <!-- 无图树洞 -->
                    <div class="treehole-item">
                        <div class="treehole-header">
                            <div class="user-info">
                                <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                                <div>
                                    <div class="user-name">星辰大海</div>
                                    <div class="post-meta">
                                        <span>2小时前 · 情感</span>
                                        <span class="distance-badge"><i class="fas fa-map-marker-alt"></i> 0.8km</span>
                                    </div>
                                </div>
                            </div>
                            <button class="more-options">
                                <i class="fas fa-ellipsis-h"></i>
                            </button>
                        </div>
                        <div class="treehole-content">
                            最近感觉很迷茫，不知道自己真正想要的是什么。工作稳定但没有激情，想辞职又怕找不到更好的。有没有人有过类似的经历，能给点建议吗？
                        </div>
                        <div class="treehole-actions">
                            <button class="action-btn">
                                <i class="far fa-comment"></i>
                                <span>32</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-heart"></i>
                                <span>56</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-star"></i>
                                <span>收藏</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-share-alt"></i>
                                <span>分享</span>
                            </button>
                        </div>
                    </div>
                    
                    <!-- 单图树洞 -->
                    <div class="treehole-item">
                        <div class="treehole-header">
                            <div class="user-info">
                                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="user-avatar">
                                <div>
                                    <div class="user-name">咖啡不加糖</div>
                                    <div class="post-meta">
                                        <span>昨天 19:45 · 爱好</span>
                                        <span class="distance-badge"><i class="fas fa-map-marker-alt"></i> 1.2km</span>
                                    </div>
                                </div>
                            </div>
                            <button class="more-options">
                                <i class="fas fa-ellipsis-h"></i>
                            </button>
                        </div>
                        <div class="treehole-content">
                            周末发现的一家小众咖啡馆，环境特别好，咖啡也很正宗。有没有喜欢探店的朋友，下次可以一起啊~
                        </div>
                        <div class="images-container single">
                            <img src="https://picsum.photos/id/431/800/600" alt="咖啡馆照片" class="treehole-image">
                        </div>
                        <div class="treehole-actions">
                            <button class="action-btn">
                                <i class="far fa-comment"></i>
                                <span>18</span>
                            </button>
                            <button class="action-btn liked">
                                <i class="fas fa-heart"></i>
                                <span>94</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-star"></i>
                                <span>收藏</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-share-alt"></i>
                                <span>分享</span>
                            </button>
                        </div>
                    </div>
                `;
                
                // 如果没有筛选结果，显示空状态
                if (appliedFilters.size > 0 && Math.random() > 0.7) { // 随机模拟无结果
                    treeholeList.innerHTML = `
                        <div class="empty-state">
                            <i class="far fa-folder-open"></i>
                            <p>没有找到符合筛选条件的内容</p>
                            <button id="clearAllFilters">清除所有筛选</button>
                        </div>
                    `;
                    
                    // 清除所有筛选按钮事件
                    document.getElementById('clearAllFilters').addEventListener('click', () => {
                        clearAllFilterTags();
                        document.getElementById('resetFilters').click();
                        applyFilters();
                    });
                }
                
                // 重新绑定事件
                bindEvents();
            }, 1500);
        }
        
        // 分类标签快速切换
        const categoryTabs = document.querySelectorAll('.category-tab');
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                categoryTabs.forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
                
                // 添加筛选标签
                clearAllFilterTags();
                addFilterTag(tab.textContent, 'category');
                updateFilterButtons();
                
                // 模拟加载新内容
                applyFilters();
            });
        });
        
        // 点赞功能
        function bindEvents() {
            const likeButtons = document.querySelectorAll('.action-btn');
            likeButtons.forEach(button => {
                if (button.querySelector('.fa-heart')) {
                    button.addEventListener('click', () => {
                        const icon = button.querySelector('i');
                        const countEl = button.querySelector('span');
                        let count = parseInt(countEl.textContent);
                        
                        if (icon.classList.contains('far')) {
                            icon.classList.remove('far');
                            icon.classList.add('fas');
                            button.classList.add('liked');
                            countEl.textContent = count + 1;
                        } else {
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            button.classList.remove('liked');
                            countEl.textContent = count - 1;
                        }
                    });
                }
            });
        }
        
        // 发布按钮点击事件
        document.querySelector('.add-post-btn').addEventListener('click', () => {
            alert('跳转到发布树洞页面');
        });
        
        // 初始化绑定事件
        bindEvents();
    </script>
</body>
</html>

